#include "Md5Sum.hpp"
#include <fstream>
#include <sstream>
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cout << "请传入文件名" << std::endl;
        std::abort();
    }

    std::ifstream file(argv[1], std::ios::binary);
    if (file.is_open() == false)
    {
        std::cout << "file open failed" << std::endl;
        std::abort();
    }
    std::ostringstream buf;
    buf << file.rdbuf();
    std::string hash = Md5Sum::calculate(buf.str());
    std::cout << "MD5(\"" << argv[1] << "\")" << hash << std::endl;
    return 0;
}